'use strict'
app.controller('redPacketCtrl', ['$scope', 'redPacketService', '$filter','utilService',function ($scope, redPacketService, $filter,utilService) {
    $scope.redPacketListVO = {
        status: -1,
        startTime: $filter('date')(new Date() - 30 * 24 * 60 * 60 * 1000, 'yyyy-MM-dd'),
        endTime: $filter('date')(new Date(), 'yyyy-MM-dd')
    }
    $scope.findAll = function () {
        if($scope.redPacketListVO.status==-1){
            $scope.redPacketListVO.status="";
        }
        $scope.redPacketListVO.startTime = $filter('date')($scope.redPacketListVO.startTime, 'yyyy-MM-dd');
        $scope.redPacketListVO.endTime = $filter('date')($scope.redPacketListVO.endTime, 'yyyy-MM-dd');
        utilService.queryForPagingList($scope,{
            url: $scope.app.domain + "red/packet",
            params: $scope.redPacketListVO
        }).then(function(result){

        });
    }
    $scope.changeStatus = function (status) {
        $scope.redPacketListVO.status = status;
        $scope.findAll();
    }
    $scope.changeStatus($scope.redPacketListVO.status);
}])